Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

146
Vistas
VS Code - How to use "code completion" on some object that used in another file

I currently build a back-end using NodeJs.

To make the route, I should code like this:

// sever.js
server.route({
    path: '/some/path',
    method: 'GET',
    handler: (request, reply) => {
        return reply.response('trick or treat');
    }
})

If I make the route like this, there will be code completion when I type request or reply and show all of these properties, include the info. Because the intelliSense will recognize it as a member of server object(handler's parameters).

Now, I want to separate the main server and routes. Will be look like this:

// server.js
const routes = require('./routes');

server.routes(routes);
// routes.js
module.exports = [
    {
        path: '/some/path',
        method: 'GET',
        handler: (request, reply) => {
            return reply.response('trick or treat');
        }
    },
    ...
];

Now, when I type request or reply, there is no code completion like before. What I wanted is how to make intelliSense recognise the request and reply as a member of server object so that there will be code completion, parameter info, etc.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda